import 'package:flutter/material.dart';
import 'package:flutter_saixiaoli/routes.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

class Live extends StatelessWidget {
  final List swiper;

  const Live({Key key, this.swiper}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        InkWell(
          onTap: () {
            Navigator.pushNamed(context, Routes.live);
          },
          child: Container(
            margin: EdgeInsets.only(top: 20, bottom: 10),
            padding: EdgeInsets.symmetric(horizontal: 12),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Row(
                  children: [
                    Container(
                      child: Text(
                        '相册直播',
                        style: TextStyle(
                            fontSize: 16, color: Color.fromRGBO(34, 34, 34, 1)),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(left: 10),
                      child: Image.asset(
                        'images/home/live.png',
                        width: 60,
                        height: 17,
                        fit: BoxFit.cover,
                      ),
                    )
                  ],
                ),
                Container(
                  child: Icon(
                    Icons.arrow_forward_ios_sharp,
                    size: 12,
                  ),
                )
              ],
            ),
          ),
        ),
        Container(
          width: 310,
          height: 120,
          child: Swiper(
            scrollDirection: Axis.horizontal,
            itemCount: swiper.length,
            itemBuilder: (context, index) {
              return Container(
                padding: EdgeInsets.all(10),
                decoration: BoxDecoration(
                    color: Color.fromRGBO(249, 249, 249, 1),
                    borderRadius: BorderRadius.circular(10)),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Container(
                      alignment: Alignment.bottomLeft,
                      child: InkWell(
                        onTap: () {
                          print(222);
                        },
                        child: Container(
                          alignment: Alignment.center,
                          width: 65,
                          height: 20,
                          child: Text(
                            swiper[index]['active'] ? '直播中' : '未直播',
                            style: TextStyle(
                                color: Colors.white, fontSize: 11, height: 1.3),
                          ),
                          decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(10),
                              gradient: LinearGradient(
                                  begin: Alignment.centerLeft,
                                  end: Alignment.centerRight,
                                  colors: [
                                    Color.fromRGBO(234, 53, 37, 1),
                                    Color.fromRGBO(254, 92, 17, 1)
                                  ])),
                        ),
                      ),
                    ),
                    Container(
                      alignment: Alignment.bottomRight,
                      child: SizedBox(
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.end,
                          crossAxisAlignment: CrossAxisAlignment.end,
                          children: [
                            Row(
                              children: [
                                Container(
                                  child: Text(
                                    '共',
                                    style: TextStyle(
                                        fontSize: 11,
                                        color: Color.fromRGBO(51, 51, 51, 1)),
                                  ),
                                ),
                                Container(
                                  margin: EdgeInsets.only(
                                      top: 1.5, left: 3, right: 3),
                                  child: Text(
                                    swiper[index]['num'],
                                    style: TextStyle(
                                        color: Color.fromRGBO(191, 55, 54, 1),
                                        fontSize: 13),
                                  ),
                                ),
                                Container(
                                  child: Text(
                                    '张图片',
                                    style: TextStyle(
                                        fontSize: 11,
                                        color: Color.fromRGBO(51, 51, 51, 1)),
                                  ),
                                )
                              ],
                            ),
                            Container(
                              margin: EdgeInsets.only(top: 20),
                              child: Row(
                                children: [
                                  Container(
                                    child: Text(
                                      '查看',
                                      style: TextStyle(
                                          color: Color.fromRGBO(51, 51, 51, 1),
                                          fontSize: 12),
                                    ),
                                  ),
                                  Container(
                                    child: Text(
                                      '>>',
                                      style: TextStyle(
                                          color:
                                              Color.fromRGBO(153, 153, 153, 1)),
                                    ),
                                    margin: EdgeInsets.only(left: 3),
                                  )
                                ],
                              ),
                            )
                          ],
                        ),
                      ),
                    ),
                  ],
                ),
              );
            },
          ),
        ),
      ],
    );
  }
}
